package com.cac.demo.newCode.sorting.controller;

import com.alibaba.fastjson.JSONObject;
import com.cac.demo.newCode.sorting.service.AoMatchPlanService;
import com.cac.demo.util.adapter.ResponseMsg;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.io.FileNotFoundException;

@Slf4j
@RestController
@RequestMapping("/AoMatchPlan")
@Api(tags = "预配套计算")
public class AoMatchPlanController {
    @Resource
    AoMatchPlanService cemopService;
    @PostMapping("/AoMatchPlanExecute")
    @ApiOperation(value = "虚拟计算配套任务")
    @Scheduled(cron = "0 30 2 * * ?")
    public ResponseMsg<Object> AoMatchPlanExecute(){
        return cemopService.AoMatchPlanExecute();
    }

    //月计划下发接口
    //@PostMapping("/FJ-D01-AoMonthPlan")
    @ApiOperation(value = "月计划下发")
    public ResponseMsg<Object> AoMonthPlan(@RequestBody JSONObject jsonObject){
        return cemopService.AoMonthPlan(jsonObject);
    }

    //@PostMapping("/FJ-D01-AoMonthPlanChange")
    @PostMapping("/FJ-D01-AoMonthPlan")
    @ApiOperation(value = "月计划下发更新")
    public ResponseMsg<Object> AoMonthPlanChange(@RequestBody JSONObject jsonObject) throws FileNotFoundException {
        return cemopService.AoMonthPlanChange(jsonObject);
    }

    //周计划下发接口
    //@PostMapping("/FJ-D02-AoWeekPlan")
    @ApiOperation(value = "周计划下发")
    public ResponseMsg<Object> AoWeekPlan(@RequestBody JSONObject jsonObject){
        return cemopService.AoWeekPlan(jsonObject);
    }

    @PostMapping("/FJ-D02-AoWeekPlan")
    @ApiOperation(value = "周计划下发更新")
    public ResponseMsg<Object> AoWeekPlanChange(@RequestBody JSONObject jsonObject) throws FileNotFoundException {
        return cemopService.AoWeekPlanChange(jsonObject);
    }

    //日计划下发接口
  //  @PostMapping("/FJ-D03-AoDayPlan")
    @ApiOperation(value = "日计划下发")
    public ResponseMsg<Object> AoDayPlan(@RequestBody JSONObject jsonObject){
        return cemopService.AoDayPlan(jsonObject);
    }

    @PostMapping("/FJ-D03-AoDayPlan")
    @ApiOperation(value = "日计划下发更新")
    public ResponseMsg<Object> AoDayPlanChange(@RequestBody JSONObject jsonObject) throws FileNotFoundException {
        return cemopService.AoDayPlanChange(jsonObject);
    }

    @PostMapping("/FJ-D03-AoDayPlantoChange")
    @ApiOperation(value = "日计划AO下发更新")
    public ResponseMsg<Object> AoDayPlantoChange(@RequestBody JSONObject jsonObject) throws FileNotFoundException {
        return cemopService.AoDayPlantoChange(jsonObject);
    }
}
